import React, { Component } from 'react'
import PubSub from 'pubsub-js'
export default class Fruits extends Component {
  state = {
    sun: '太阳'
  }
  componentDidMount() { 
    // 订阅消息
    PubSub.subscribe('gift', (msg, data) => { 
      console.log('data', data);
    })
  }
  render() {
    return (
      <div>
        <h2>Weather的兄弟  --  Fruits  --  { this.state.sun }</h2>
      </div>
    )
  }
}
